

<!doctype html>

<html lang="en" data-content_root="../../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>skidl.interface &#8212; SKiDL 1.2.2 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../../_static/bizstyle.css?v=a66e137f" />
    
    <script src="../../_static/documentation_options.js?v=fd7cadf9"></script>
    <script src="../../_static/doctools.js?v=9a2dae69"></script>
    <script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../../_static/bizstyle.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <!--[if lt IE 9]>
    <script src="_static/css3-mediaqueries.js"></script>
    <![endif]-->
  </head><body>
    <h1 id="site-title"><a href="../../../../"><img src="../../../../images/slim_banner.png" width="100%"></a></h1>
    
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SKiDL 1.2.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Module code</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.interface</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <h1>Source code for skidl.interface</h1><div class="highlight"><pre>
<span></span><span class="c1"># -*- coding: utf-8 -*-</span>

<span class="c1"># The MIT License (MIT) - Copyright (c) Dave Vandenbout.</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Handles interfaces for subsystems with complicated I/O.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="p">(</span>  <span class="c1"># isort:skip</span>
    <span class="n">absolute_import</span><span class="p">,</span>
    <span class="n">division</span><span class="p">,</span>
    <span class="n">print_function</span><span class="p">,</span>
    <span class="n">unicode_literals</span><span class="p">,</span>
<span class="p">)</span>

<span class="kn">from</span> <span class="nn">builtins</span> <span class="kn">import</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">super</span>

<span class="k">try</span><span class="p">:</span>
    <span class="kn">from</span> <span class="nn">future</span> <span class="kn">import</span> <span class="n">standard_library</span>
    <span class="n">standard_library</span><span class="o">.</span><span class="n">install_aliases</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
    <span class="k">pass</span>

<span class="kn">from</span> <span class="nn">.alias</span> <span class="kn">import</span> <span class="n">Alias</span>
<span class="kn">from</span> <span class="nn">.bus</span> <span class="kn">import</span> <span class="n">Bus</span>
<span class="kn">from</span> <span class="nn">.net</span> <span class="kn">import</span> <span class="n">Net</span>
<span class="kn">from</span> <span class="nn">.netpinlist</span> <span class="kn">import</span> <span class="n">NetPinList</span>
<span class="kn">from</span> <span class="nn">.pin</span> <span class="kn">import</span> <span class="n">Pin</span>
<span class="kn">from</span> <span class="nn">.protonet</span> <span class="kn">import</span> <span class="n">ProtoNet</span>
<span class="kn">from</span> <span class="nn">.skidlbaseobj</span> <span class="kn">import</span> <span class="n">SkidlBaseObject</span>
<span class="kn">from</span> <span class="nn">.utilities</span> <span class="kn">import</span> <span class="p">(</span>
    <span class="n">expand_indices</span><span class="p">,</span>
    <span class="n">export_to_all</span><span class="p">,</span>
    <span class="n">filter_list</span><span class="p">,</span>
    <span class="n">from_iadd</span><span class="p">,</span>
    <span class="n">list_or_scalar</span><span class="p">,</span>
    <span class="n">rmv_iadd</span><span class="p">,</span>
    <span class="n">to_list</span><span class="p">,</span>
<span class="p">)</span>



<div class="viewcode-block" id="Interface">
<a class="viewcode-back" href="../../rst_output/skidl.interface.html#skidl.interface.Interface">[docs]</a>
<span class="nd">@export_to_all</span>
<span class="k">class</span> <span class="nc">Interface</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    An Interface bundles a group of nets/buses into a single entity with each</span>
<span class="sd">    net/bus becoming an attribute.  An Interface is also usable as a dict</span>
<span class="sd">    where the attribute names serve as keys. This means the ** operator works</span>
<span class="sd">    on an Interface.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="c1"># Set the default ERC functions for all Interface instances.</span>
    <span class="n">erc_list</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="c1"># dict is used instead of super() throughout because using super()</span>
        <span class="c1"># caused the tests to run forever under Python 2.7.18.</span>
        <span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="nb">dict</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">&quot;match_pin_regex&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">items</span><span class="p">()):</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">):</span>
                <span class="c1"># Store the ProtoNet directly in the Interface.</span>
                <span class="c1"># It will get promoted to a Net when it gets connected to something.</span>
                <span class="n">v</span><span class="o">.</span><span class="n">aliases</span> <span class="o">+=</span> <span class="n">k</span>
                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="p">(</span><span class="n">Pin</span><span class="p">,</span> <span class="n">Net</span><span class="p">)):</span>
                <span class="n">cct</span> <span class="o">=</span> <span class="n">v</span><span class="o">.</span><span class="n">circuit</span>
                <span class="n">n</span> <span class="o">=</span> <span class="n">Net</span><span class="p">(</span><span class="n">circuit</span><span class="o">=</span><span class="n">cct</span><span class="p">)</span>
                <span class="n">n</span><span class="o">.</span><span class="n">aliases</span> <span class="o">+=</span> <span class="n">k</span>
                <span class="n">n</span> <span class="o">+=</span> <span class="n">v</span>
                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="p">(</span><span class="n">Bus</span><span class="p">,</span> <span class="n">NetPinList</span><span class="p">)):</span>
                <span class="n">cct</span> <span class="o">=</span> <span class="n">v</span><span class="o">.</span><span class="n">circuit</span>
                <span class="n">b</span> <span class="o">=</span> <span class="n">Bus</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">v</span><span class="p">),</span> <span class="n">circuit</span><span class="o">=</span><span class="n">cct</span><span class="p">)</span>
                <span class="n">b</span><span class="o">.</span><span class="n">aliases</span> <span class="o">+=</span> <span class="n">k</span>
                <span class="n">b</span> <span class="o">+=</span> <span class="n">v</span>
                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">v</span><span class="p">)):</span>
                    <span class="n">n</span> <span class="o">=</span> <span class="n">Net</span><span class="p">(</span><span class="n">circuit</span><span class="o">=</span><span class="n">cct</span><span class="p">)</span>
                    <span class="n">n</span><span class="o">.</span><span class="n">aliases</span> <span class="o">+=</span> <span class="n">k</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
                    <span class="n">n</span> <span class="o">+=</span> <span class="n">b</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                    <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">),</span> <span class="n">n</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">SkidlBaseObject</span><span class="p">):</span>
                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="nb">dict</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__getattribute__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
        <span class="n">value</span> <span class="o">=</span> <span class="nb">dict</span><span class="o">.</span><span class="fm">__getattribute__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">):</span>
            <span class="c1"># If the retrieved attribute is a ProtoNet, record where it came from.</span>
            <span class="n">value</span><span class="o">.</span><span class="n">intfc_key</span> <span class="o">=</span> <span class="n">key</span>
            <span class="n">value</span><span class="o">.</span><span class="n">intfc</span> <span class="o">=</span> <span class="bp">self</span>
        <span class="k">return</span> <span class="n">value</span>

    <span class="k">def</span> <span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="w">        </span><span class="sd">&quot;&quot;&quot;Sets attribute and also a dict entry with a key using the attribute name.&quot;&quot;&quot;</span>
        <span class="nb">dict</span><span class="o">.</span><span class="fm">__setitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
        <span class="nb">dict</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">io_ids</span><span class="p">,</span> <span class="o">**</span><span class="n">criteria</span><span class="p">):</span>
<span class="w">        </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Return list of part pins selected by identifiers.</span>

<span class="sd">        Args:</span>
<span class="sd">            io_ids: A list of strings containing I/O names,</span>
<span class="sd">                regular expressions, slices, lists or tuples. If empty,</span>
<span class="sd">                then it will select all pins.</span>

<span class="sd">        Keyword Args:</span>
<span class="sd">            criteria: Key/value pairs that specify attribute values the</span>
<span class="sd">                I/Os must have in order to be selected.</span>

<span class="sd">        Returns:</span>
<span class="sd">            A list of I/Os matching the given IDs and satisfying all the criteria,</span>
<span class="sd">            or just a single I/O object if only a single match was found.</span>
<span class="sd">            Or None if no match was found.</span>

<span class="sd">        Notes:</span>
<span class="sd">            Pins can be selected from a part by using brackets like so::</span>

<span class="sd">                intf = Interface(a=Net(), b=Net())</span>
<span class="sd">                net = Net()</span>
<span class="sd">                intf[&#39;a&#39;] += net  # Connects I/O &#39;a&#39; of interface to the net.</span>
<span class="sd">                net += intf.b     # Connects the net to the &#39;b&#39; I/O.</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="c1"># Extract permission to search for regex matches in pin names/aliases.</span>
        <span class="n">match_regex</span> <span class="o">=</span> <span class="n">criteria</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;match_regex&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">match_pin_regex</span>

        <span class="c1"># If no pin identifiers were given, then use a wildcard that will</span>
        <span class="c1"># select all pins.</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">io_ids</span><span class="p">:</span>
            <span class="n">io_ids</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;.*&quot;</span><span class="p">]</span>
            <span class="n">match_regex</span> <span class="o">=</span> <span class="kc">True</span>

        <span class="c1"># An interface doesn&#39;t have pins, so set pin slice bounds to zero.</span>
        <span class="n">min_pin</span><span class="p">,</span> <span class="n">max_pin</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span>

        <span class="c1"># Get I/O entries.</span>
        <span class="n">io_types</span> <span class="o">=</span> <span class="p">(</span><span class="n">Net</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">,</span> <span class="n">Pin</span><span class="p">,</span> <span class="n">NetPinList</span><span class="p">,</span> <span class="n">Bus</span><span class="p">)</span>
        <span class="n">ios</span> <span class="o">=</span> <span class="p">[</span><span class="n">io</span> <span class="k">for</span> <span class="n">io</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">io</span><span class="p">,</span> <span class="n">io_types</span><span class="p">)]</span>

        <span class="c1"># Use this for looking up the dict key using the id of a given I/O.</span>
        <span class="n">id_to_key</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> <span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>

        <span class="c1"># Go through the I/O entries and find the ones selected by the IDs.</span>
        <span class="n">selected_ios</span> <span class="o">=</span> <span class="n">NetPinList</span><span class="p">()</span>
        <span class="k">for</span> <span class="n">io_id</span> <span class="ow">in</span> <span class="n">expand_indices</span><span class="p">(</span><span class="n">min_pin</span><span class="p">,</span> <span class="n">max_pin</span><span class="p">,</span> <span class="n">match_regex</span><span class="p">,</span> <span class="o">*</span><span class="n">io_ids</span><span class="p">):</span>

            <span class="c1"># Look for an exact match of the I/O key name with the current ID.</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="n">io</span> <span class="o">=</span> <span class="nb">dict</span><span class="o">.</span><span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">io_id</span><span class="p">)</span>
            <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span>
                <span class="c1"># No exact match on I/O key name, so keep looking below.</span>
                <span class="k">pass</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="c1"># Add exact match to the list of selected I/Os and go to the next ID.</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">io</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">):</span>
                    <span class="c1"># Store key for this ProtoNet I/O so we&#39;ll know where to update it later.</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc</span> <span class="o">=</span> <span class="bp">self</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc_key</span> <span class="o">=</span> <span class="n">io_id</span>
                <span class="n">selected_ios</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">io</span><span class="p">)</span>
                <span class="k">continue</span>

            <span class="c1"># Check I/O aliases for an exact match with the current ID.</span>
            <span class="n">tmp_ios</span> <span class="o">=</span> <span class="n">filter_list</span><span class="p">(</span><span class="n">ios</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="n">io_id</span><span class="p">,</span> <span class="n">do_str_match</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">criteria</span><span class="p">)</span>
            <span class="k">for</span> <span class="n">io</span> <span class="ow">in</span> <span class="n">tmp_ios</span><span class="p">:</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">io</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">):</span>
                    <span class="c1"># Store key for this ProtoNet I/O so we&#39;ll know where to update it later.</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc</span> <span class="o">=</span> <span class="bp">self</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc_key</span> <span class="o">=</span> <span class="n">id_to_key</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">io</span><span class="p">)]</span>
                <span class="n">selected_ios</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">io</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">tmp_ios</span><span class="p">:</span>
                <span class="c1"># Found exact match between alias and ID, so done with this ID and go to next ID.</span>
                <span class="k">continue</span>

            <span class="c1"># Skip regex matching if not enabled.</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">match_regex</span><span class="p">:</span>
                <span class="k">continue</span>

            <span class="c1"># OK, ID doesn&#39;t exactly match an I/O name or alias. Does it match as a regex?</span>
            <span class="n">tmp_ios</span> <span class="o">=</span> <span class="n">filter_list</span><span class="p">(</span><span class="n">ios</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="n">Alias</span><span class="p">(</span><span class="n">io_id</span><span class="p">),</span> <span class="o">**</span><span class="n">criteria</span><span class="p">)</span>
            <span class="k">for</span> <span class="n">io</span> <span class="ow">in</span> <span class="n">tmp_ios</span><span class="p">:</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">io</span><span class="p">,</span> <span class="n">ProtoNet</span><span class="p">):</span>
                    <span class="c1"># Store key for this ProtoNet I/O so we&#39;ll know where to update it later.</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc</span> <span class="o">=</span> <span class="bp">self</span>
                    <span class="n">io</span><span class="o">.</span><span class="n">intfc_key</span> <span class="o">=</span> <span class="n">id_to_key</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">io</span><span class="p">)]</span>
                <span class="n">selected_ios</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">io</span><span class="p">)</span>

        <span class="c1"># Return list of I/Os that were selected by the IDs.</span>
        <span class="k">return</span> <span class="n">list_or_scalar</span><span class="p">(</span><span class="n">selected_ios</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__setitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="w">        </span><span class="sd">&quot;&quot;&quot;Sets dict entry and also creates attribute with the same name as the dict key.&quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="n">from_iadd</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
            <span class="c1"># The += flag in the values are no longer needed.</span>
            <span class="n">rmv_iadd</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
            <span class="c1"># If interface items are being changed as a result of += operator...</span>
            <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">to_list</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
                <span class="c1"># Look for interface key name attached to each value.</span>
                <span class="c1"># Only ProtoNets should have them because they need to be</span>
                <span class="c1"># changed to a Net or Bus once they are connected to something.</span>
                <span class="n">key</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="s2">&quot;intfc_key&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">key</span><span class="p">:</span>
                    <span class="c1"># Set the ProtoNet in the interface entry with key to its new Net or Bus value.</span>
                    <span class="nb">dict</span><span class="o">.</span><span class="fm">__setitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
                    <span class="nb">dict</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># This is for a straight assignment of value to key.</span>
            <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span></div>

</pre></div>

            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SKiDL 1.2.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >Module code</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.interface</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
    &#169; Copyright 2016-2024, Dave Vandenbout.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
    </div>
  </body>
</html>